#define _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>
#include<math.h>

int main() {
	int a=1,b=1,  c,num=0;
	scanf("%d", &c);
		for (a; a < c; a++)
		{
			for (b; b < c; b++)
			{
				if (a * a + b * b == c * c) {
					num++;
					
				}
			}
		}
		printf("%d\n", num);
	

}















